cmake_minimum_required(VERSION 3.22.0)
project(demo)

# 添加可执行文件
add_executable(main main.cpp)

# 查找log4cpp库的路径
find_path(LOG4CPP_INCLUDE_DIRS log4cpp/Appender.hh)

if (LOG4CPP_INCLUDE_DIRS)
    return ()
    message(STATUS "Found log4cpp: ${LOG4CPP_INCLUDE_DIRS}")
    include_directories(${LOG4CPP_INCLUDE_DIRS})
else ()
    message(FATAL_ERROR "log4cpp library not found")
    return ()
endif ()

# 指定log4cpp库的路径
set(LOG4CPP_LIBRARIES ${LOG4CPP_INCLUDE_DIRS}/to/log4cpp/lib/liblog4cpp.a)

# 链接log4cpp库到可执行文件
target_link_libraries(main ${LOG4CPP_LIBRARIES})
